package com.hzh302.io;

import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;

public class NioTest {

	public void listen() throws Exception {
		SocketChannel channel = SocketChannel.open();
		channel.configureBlocking(false);
		Selector selector = Selector.open();
		SelectionKey selectionKey = channel.register(selector,
				SelectionKey.OP_ACCEPT);
		while(true){
			int key = selector.select();
			System.out.println(key);
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
